public class Main {
    public static void main(String[] args) {
        TextEditor editor = new TextEditor();
        Caretaker caretaker = new Caretaker();

        editor.type(" 111");
        caretaker.saveState(editor);
        System.out.println("当前文本：" + editor.getText());

        editor.type(" 222");
        caretaker.saveState(editor);
        System.out.println("当前文本：" + editor.getText());

        editor.type(" 333");
        System.out.println("当前文本：" + editor.getText());

        caretaker.undo(editor);
        System.out.println("撤销后：" + editor.getText());

        caretaker.undo(editor);
        System.out.println("二次撤销后：" + editor.getText());
    }
}